# AMAR ET AL. - COUNTERING MISINFORMATION EARLY (2025)
## REPLICATION FILE: 00_master.R
### This master script runs all scripts necessary to replicate the analyses in the main paper and the appendix.
### Before executing, please review the README.html file in the main replication folder.
# ----
# INSTALL PACMAN ----
if (! requireNamespace("pacman", quietly = TRUE)) {
  install.packages("pacman")
  loadNamespace("pacman")
}

# EXECUTE ALL CODE ----
# Create list of scripts

scripts <- c(
  "01_data_cleaning.R",
  "02_load_packages_and_data.R",
  "03_attendance.R",
  "04_compliance.R",
  "05_balance.R",
  "06_attrition_endline.R",
  "07_attrition_follow_up.R",
  "08_descriptives.R",
  "09_regressions_main.R",
  "10_heterogeneity_analyses.R",
  "11_subgroup_analyses.R",
  "12_robust_multiple_hyp.R",
  "13_robust_compliance.R",
  "14_robust_attrition.R",
  "15_robust_alt_spec.R",
  "16_robust_alt_discernment_indx.R",
  "17_robust_follow_up_order.R",
  "18_effect_in_median_shift.R",
  "19_census_balance_test.R",
  "20_teacher_analysis.R",
  "21_party_id.R")

# Run each script sequentially
for (script in scripts) {
  cat("Running:", script, "...\n")
  source(file.path("code", script),
         echo = TRUE)
}

cat("All scripts have been successfully executed.\n")